package com.lw.entity;

import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 用户信息表 实体类。
 *
 * @author lw
 * @since 2025年05月15日 08:17:48
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "用户信息表")
@Table("tb_user")
public class TbUser implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Id(keyType = KeyType.Auto)
    @Schema(description = "ID")
    @ExcelProperty(value = "ID")
    private Long id;

    /**
     * 用户名
     */
    @Schema(description = "用户名")
    @ExcelProperty(value = "用户名")
    private String username;

    /**
     * 昵称
     */
    @Schema(description = "昵称")
    @ExcelProperty(value = "昵称")
    private String nickname;

    /**
     * 性别((1-男 2-女 0-保密)
     */
    @Schema(description = "性别((1-男 2-女 0-保密)")
    @ExcelProperty(value = "性别")
    private Integer gender;

    /**
     * 密码
     */
    @Schema(description = "密码")
    @JsonIgnore
    @ExcelIgnore
    private String password;

    /**
     * 部门ID
     */
    @Schema(description = "部门ID")
    @ExcelProperty(value = "部门ID")
    private Integer deptId;

    /**
     * 用户头像
     */
    @Schema(description = "用户头像")
    private String avatar;

    /**
     * 联系方式
     */
    @Schema(description = "联系方式")
    @ExcelProperty(value = "联系方式")
    private String mobile;

    /**
     * 状态(1-正常 0-禁用)
     */
    @Schema(description = "状态(1-正常 0-禁用)")
    @ExcelProperty(value = "状态")
    private Boolean status;

    /**
     * 用户邮箱
     */
    @Schema(description = "用户邮箱")
    @ExcelProperty(value = "用户邮箱")
    private String email;

    /**
     * 创建时间
     */

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(onInsertValue = "now()")
    @ExcelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID")
    private Long createBy;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(onUpdateValue = "now()")
    @ExcelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 修改人ID
     */
    @Schema(description = "修改人ID")
    private Long updateBy;

    /**
     * 逻辑删除标识(0-未删除 1-已删除)
     */
    @Schema(description = "逻辑删除标识(0-未删除 1-已删除)")
    private Boolean isDeleted;

    /**
     * 微信 openid
     */
    @Schema(description = "微信 openid")
    private String openid;

    /**
     * 部门名称
     */
    @Column(ignore = true)
    @Schema(hidden = true)
    @ExcelProperty(value = "部门名称")
    private String deptName;

    /**
     * 角色名称集合
     */
    @Column(ignore = true)
    @Schema(hidden = true)
    private Set<Long> roleIds;

    /**
     * 权限集合
     */
    @Column(ignore = true)
    @Schema(hidden = true)
    private Set<String> perms;

}
